package com.nwpu.vote.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class VoteUser {

	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String name;
    
    @Persistent
    private String mail;
    
    @Persistent
    private String department;
    
    @Persistent
    private String phone;
    
    @Persistent
    private String mobile;
    
    @Persistent
    private String description;
    
    @Persistent
    private Date createDate;
        
    @Persistent
    private Set<Key> votedVotes = new HashSet<Key>();

   public VoteUser(Key key, String name, String mail, String department, Date createDate, 
		   String phone, String mobile, String description) {
	    this.key = key;
		this.name = name;
		this.mail = mail;
		this.department = department;
		this.createDate = createDate;
		this.phone = phone;
		this.mobile = mobile;
		this.description = description;
	}

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getDepartment() {
		return department;
	}
	
	public void setDepartment(String department) {
		this.department = department;
	}
	
	public String getMail() {
		return mail;
	}
	
	public void setMail(String mail) {
		this.mail = mail;
	}
	
	public Date getCreateDate() {
		return createDate;
	}
	
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
	public String getDescription() {
		return description;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getPhone() {
		return phone;
	}
	
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	public String getMobile() {
		return mobile;
	}
	
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	
	public Set<Key> getVotedVotes() {
		return votedVotes;
	}
	
	public void addVotedVote(Vote vote){
		this.votedVotes.add(vote.getKey());
	}

}
